/*
** SMSE2K API
*/

#define DLLEXPORT extern "C" __declspec(dllexport)
#define FCN_NAME(x) __cdecl x // DLL interface built using CDECL

// This needs to be included!
#include "IMediaPlayer.h"

class CSmseContext {
	private:
		CHardware* hardware;
		IDriver*   driver;

	public:

		// EnterCleaningMode: Enters cleaning (optimization) mode. This will force
		// cache mode and will keep running emulation until it's done cleaning the set.
		void EnterCleaningMode(UINT32 startcode, UINT32 endcode, UINT32 step);
	

		void Stats();
		void SetOutput(int sr, int ch);
		void Close();
		int BootDriver(const char* name); // BootDriver is used to start a driver up if it doesn't support file types.
		int LoadFile(char* fn);			  // LoadFile gets a driver to load, parse and play a file.
		int Buffer(short* buf, int length);
		void SetTrack(UINT32 code);
};

typedef UINT8* HSmseTag;
typedef CSmseContext* HSmseContext;


/*******************************************************************************************
										 C API Exports

These are initialized as pointers to the functions themselves, this is done to reduce time
to build newer versions by using GetProcAddress() instead of DLL imports.
*******************************************************************************************/

DLLEXPORT CSmseContext* SMSE_NewContext();

DLLEXPORT void SMSE_Stats();
DLLEXPORT HSmseTag SMSE_LoadTags(char* fn);
DLLEXPORT int SMSE_SaveTags(char* fn);
DLLEXPORT char* SMSE_GetTagValue(HSmseTag tag, char* tagfield);
DLLEXPORT void  SMSE_SetTagValue(HSmseTag tag, char* tagfield, char* value);

DLLEXPORT void SMSE_SetOutput(HSmseContext ctx, int sr, int ch);
DLLEXPORT void SMSE_Close(HSmseContext ctx);
DLLEXPORT int SMSE_LoadFile(HSmseContext, char* fn);
DLLEXPORT int SMSE_BootDriver(HSmseContext, char* name);
DLLEXPORT int SMSE_Buffer(HSmseContext ctx, short* buf, int length);
DLLEXPORT void SMSE_SetTrack(HSmseContext ctx, UINT32 code);
